1. Field
This disclosure relates generally to processor systems, and more specifically but not exclusively, to methods and apparatus for arithmetic operations performed by processors.
2. Description
Decimal floating-point multiplications are typically implemented in software because there is no specialized hardware for decimal floating-point multiplications in most modern processors. A floating-point number (D) is normally represented by a coefficient (C) and an exponent (E), i.e., D=C·10^E, where both C and E are decimal integers. The precision of such a representation may be determined by the number of decimal digits in C, with more decimal digits in C resulting in more precise representation of D. Assume that coefficients and exponents of decimal floating-point numbers are stored in a binary format in a computer. A typical process for calculating a multiplication between two decimal floating-point numbers (e.g., D1=C1·10^E1, and D2=C2·10^E2) is as follows: convert coefficients (C1 and C2) and exponents (E1 and E2) from binary to decimal; perform a decimal integer multiplication between C1 and C2 and a decimal integer addition between E1 and E2; round exact decimal results (C1·C2 and E1+E2) correctly to the destination precision; and then convert the coefficient and exponent of the final results from decimal back to binary.
Although it would be possible to store coefficients and exponents of decimal floating-point numbers in a decimal format (e.g., Binary-Coded Decimal (BCD) format) all the time, then the advantage offered by existing instructions or circuitry that operate on binary numbers could not be taken of directly. In the above process for decimal floating-point multiplication, conversion back and forth between decimal and binary formats and decimal integer multiplication and addition consume a number of clock cycles. More importantly, the rounding operation for the final results, which typically uses remainder-based calculation, is very expensive in terms of clock cycles. Thus, it is desirable to have faster approaches for decimal floating-point multiplications so that the overall performance of a computing system can be improved.